//
// Created by bbnf on 09.06.2024.
//
#include "pch.h"
#include "gui.h"

using TF = TodoApp::Storage::TodoStorage::TodoFilter;

static auto current_filter = TF::All;
static size_t current_todo_index = 0;

namespace TodoApp::Gui {
    static const auto todo_filters =
            std::map<TF, std::string>(
                    {
                            {TF::All,            "ALL"},
                            {TF::OnlyDone,       "DONE"},
                            {TF::LowPriority,    "LOW"},
                            {TF::MediumPriority, "MEDIUM"},
                            {TF::HighPriority,   "HIGH"}
                    });

    void draw_header() {
//        std::cout << getenv("APPDATA");
        std::cout << "CATEGORIES: \n---------\n";
        for (auto it = todo_filters.begin(); it != todo_filters.end(); it++) {
            if (it->first == current_filter) {
                std::cout << std::format("[{}]", it->second);
            } else {
                std::cout << std::format("{}", it->second);
            }

            if (it != todo_filters.end()) {
                std::cout << " ";
            }
        }

        std::cout << "\n---------\n";
    }

    void draw_ui() {
        draw_header();
    }

    void set_current_filter(TodoApp::Storage::TodoStorage::TodoFilter filter) {
        current_filter = filter;
    }
}  // namespace TodoApp::Gui
